<template>
	<view class="page">
		<view class="mode u-margin-top-40">
			<view class="u-flex  ">
				<view>
					<u-image :src="$Url( info.project_info.images.split(',')[0]) " width="158" height="128"></u-image>
				</view>
				
				<view class="u-flex u-row-between u-flex-1">
					<view class="u-margin-left-20">
						<view class="u-font-weight u-font-lg">{{info.project_info.name}}</view>
						<view class="u-margin-top-20 " style="color: #00C08D;">
							技师：{{info.technician_info.nickname}}
						   <text class="u-margin-left-20">服务时间：{{info.project_info.service_duration}}分钟</text> 
						</view>
					</view>
					
				</view>
				
			</view>
			
			
			<view class="u-margin-top-20">
				<text class="u-margin-right-20">综合评分</text>
				<u-rate :value="value" active-color="#FFCC00"></u-rate>
			</view>
			
			
			<view  class="u-margin-top-20">
				<u-input :clearable="false"  :custom-style="{background:'#f1f1f1',padding:'20rpx'}" v-model="text" type="textarea" placeholder="请留下您的金句吧" height="300"/>
			</view>
			
			
			<view style="background: #F1F1F1;padding: 20rpx 0  5rpx 20rpx;">
				<wr-upload_img width="150" height="150" iconsize="40" background="#e1e1e1" ref="images" type="image" :afterLoadUrl="imageUrl" defaultLength="3"  cutType="imageUrl" >
				</wr-upload_img>
			</view>
		
			<!-- let avatar=this.$refs.avatar.afterUploadImgList; -->
		</view>
		
		
		<view class="bottomFix">
			<u-button @click="sumbit" type="success">提交</u-button>
		</view>
			
			<u-toast ref="uToast" />
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:"",
				info:{
					
				},
				value:5,
				text:''
			}
		},
		onLoad(options) {
			if(options.id){
				this.id=options.id
			}
			this.jiazai()
			
		},
		methods:{
			jiazai(){
				this.$u.post('/user/getOrderDetails', {
					trade_no:this.id
				}).then(res => {
					this.info=res;
				}).catch(err => {})
			},
			
			
			sumbit(){
				if(!this.text){
					this.$u.toast("内容不能为空")
					return
				}
				let images=this.$refs.images.afterUploadImgList;
				this.$u.post('/technician/comments', {
					order_trade_no:this.id,
					star:this.value,
					content:this.text,
					images:images.length?images.join(","):''
				}).then(res => {
					this.$refs.uToast.show({
						title: '提交成功',
						type: 'success',
						back:true
					})
				}).catch(err => {
				})
			}
			
			
		}
	}
</script>

<style>
	.page{
		background: #F1F1F1;
		min-height: 100vh;
		display: inline-block;
		width: 750rpx;
	}
	
</style>
